package io.renren.modules.sys.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.CourseuserDao;
import io.renren.modules.sys.entity.CourseuserEntity;
import io.renren.modules.sys.service.CourseuserService;


@Service("courseuserService")
public class CourseuserServiceImpl extends ServiceImpl<CourseuserDao, CourseuserEntity> implements CourseuserService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String statu = (String)params.get("statu");
        IPage<CourseuserEntity> page = this.page(
                new Query<CourseuserEntity>().getPage(params),
                new QueryWrapper<CourseuserEntity>()
                        .eq(StringUtils.isNotBlank(statu), "statu", statu)
                        .orderByDesc("createtime")
        );

        return new PageUtils(page);
    }

}
